package cn.iocoder.yudao.module.squaredancing.dal.mysql.video;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.squaredancing.dal.dataobject.video.VideoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.squaredancing.controller.admin.video.vo.*;

/**
 * 视频管理 Mapper
 *
 * @author 赵云安
 */
@Mapper
public interface VideoMapper extends BaseMapperX<VideoDO> {

    default PageResult<VideoDO> selectPage(VideoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VideoDO>()
                .eqIfPresent(VideoDO::getTitle, reqVO.getTitle())
                .eqIfPresent(VideoDO::getDescription, reqVO.getDescription())
                .eqIfPresent(VideoDO::getCoverUrl, reqVO.getCoverUrl())
                .eqIfPresent(VideoDO::getVideoUrl, reqVO.getVideoUrl())
                .eqIfPresent(VideoDO::getDuration, reqVO.getDuration())
                .eqIfPresent(VideoDO::getViewCount, reqVO.getViewCount())
                .eqIfPresent(VideoDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(VideoDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(VideoDO::getCreateBy, reqVO.getCreateBy())
                .eqIfPresent(VideoDO::getUpdateBy, reqVO.getUpdateBy())
                .orderByDesc(VideoDO::getId));
    }

}